<?php
@header("Content-Type:text/html;charset=utf-8");
@include_once("conn.php");
@include_once("common.php");


if(!(isset($_GET["id"]))){
    paramsErr();
}

$id=$_GET["id"];
$sql="delete from `shoppingcart` where id='$id'";
$result=mysqli_query($conn,$sql);
$obj=array();
if($result){ // 判断sql执行的结果(增删改)

    $rows = mysqli_affected_rows($conn);

    if($rows > 0){
        $obj["status"] = true;
        $obj["msg"] = "删除成功";
    }else{  // 注册不会出现此情况
        $obj["status"] = false;
        $obj["msg"] = "删除失败,未查询到该数据";
    }
}else{
    $obj["status"] = false;
    $obj["msg"] = "sql语句有误";
    $obj["sql"] = $sql;
} 
echo json_encode($obj);
?>